import axios from 'axios'
const request = axios.create(
  {
    baseURL: import.meta.env.VITE_BASE_URL,
    timeout: 10000
  },
)
request.interceptors.request.use(config => {
  return config;
}, error => {
  return Promise.reject(error);
});
request.interceptors.response.use(response => {
  if (response.data.code != 200) {
    alert("请求错误了")
  }
  return response.data;
}, error => {
  alert("请求错误")
  throw new Error(error)
});
export default request